import network



wlan = network.WLAN(network.STA_IF) # create station interface
#wlan.active(True)       # activate the interface
#wlan.scan()             # scan for access points

if wlan.isconnected():
    print('wifi连接成功')
    print(wlan.ifconfig())
else :
    print('wifi连接失败')

